﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/User.Master" Inherits="System.Web.Mvc.ViewPage<SDT.Site.Areas.User.ViewModels.CompanyEditViewModel>" %>

<%@ Import Namespace="SDT.Lib.Helpers" %>
<asp:Content ID="Content1" ContentPlaceHolderID="TitleContent" runat="server">
    Đăng tin doanh nghiệp
</asp:Content>
<asp:Content ID="Content3" ContentPlaceHolderID="Header" runat="server">
    Đăng tin doanh nghiệp
</asp:Content>
<asp:Content ID="Content6" ContentPlaceHolderID="Message" runat="server">
    <%=ViewData["MessageInfo"]!=null? "<p class='perror'>"+Html.Encode(ViewData["MessageInfo"])+"</p>":string.Empty%>
</asp:Content>
<asp:Content ID="Content4" ContentPlaceHolderID="Toolbar" runat="server">
    <td>
        <%= Html.Toolbar("Quay về", "/User/company", "back") %>
    </td>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
    <%if (ViewData["MessageInfo"] == null)
      { %>
    <% using (Html.BeginForm("Create", "company", FormMethod.Post, new { id = "adminForm", enctype = "multipart/form-data" }))
       {%>
    <%= Html.ValidationSummary(true)%>
    <fieldset>
        <legend>Đăng tin</legend>
    <table class="admintable" width="100%">
        <tbody>
            <tr>
                <td class="key">
                    Tiêu đề (<font color="red">*</font>)
                </td>
                <td>
                    <%=Html.TextBoxFor(m => m.Article.Title, new { style = "width:560px;height:20px", @class = "required" })%>
                </td>
            </tr> 
            <tr>
                <td class="key">
                    Ảnh đại diện
                </td>
                <td>
                    <input type="file" name="ArticleImage" id="ArticleImage" />
                </td>
            </tr>
            <tr>
                <td class="key">
                    Tóm tắt (<font color="red">*</font>)
                </td>
                <td>
                    <%=Html.TextAreaFor(m => m.Article.Summary, new { style = "width:560px; height:60px;", cols = 120, @class = "required" })%>
                </td>
            <tr>
                <td class="key">
                    Nội dung(<font color="red">*</font>)
                </td>
                <td>
                    <%=Html.TextAreaFor(m => m.Article.ArticleContent, new { cols = 30, rows = 20, style = "width:560px; height:360px;",@class="required" })%>
                </td>
            </tr>
            <tr>
                <td class="key">Bài viết cho doanh nghiệp</td>
                <td><%=Html.DropDownList("CompanyID", new SelectList(Model.Companys, "ID", "Name").ToList(), "-- Chọn doanh nghiệp --", new { @class = "title", style = "width:300px" })%></td>
            </tr>
            <tr>
                <td colspan="2" align="center">
                    <input type="submit" id="btnSave" value="Đăng tin" onclick="return check_extension('ArticleImage','btnSave');" />
                    <input type="reset" id="btnReset" value="Nhập lại" />
                </td>
            </tr>            
        </tbody>
    </table>
    </fieldset>
    <%}
  } %>
  
    <script type="text/javascript">
        $(document).ready(function() {
            $("#adminForm").validate();

            $("#TinhSauNhanThe").unbind("click").click(function() {
                $("#dialogAddTag").dialog({ width: 350, resizable: false, modal: true });
            });
        });

        var fileIndex = 1;
        var hash = { '.jpg': 1, '.png': 1, '.gif': 1, '.doc': 1, '.docx': 1, '.xls': 1, '.xlsx': 1, '.zip': 1, '.rar': 1, '.ppt': 1, '.pptx': 1, '.txt:':1 };
        function check_extension(filename, submitId) {
            var re = /\..+$/;
            var ext = filename.match(re).toString().toLowerCase();
            var submitEl = document.getElementById(submitId);
            if (hash[ext]) {
                submitEl.disabled = false;
                return true;
            } else {
            }
        }                
        tinyMCE.init({
            mode: "exact",
            elements: "Article_ArticleContent",
            theme: "advanced",
            plugins: "spellchecker,pagebreak,style,layer,table,save,advhr,advimage,advlink,emotions,iespell,inlinepopups,insertdatetime,preview,media,searchreplace,print,contextmenu,paste,directionality,fullscreen,noneditable,visualchars,nonbreaking,xhtmlxtras,template,paste,imagemanager",
            theme_advanced_buttons1: "save,newdocument,|,bold,italic,underline,strikethrough,|,justifyleft,justifycenter,justifyright,justifyfull,|,styleselect,formatselect,fontselect,fontsizeselect",
            theme_advanced_buttons2: "cut,copy,paste,pastetext,pasteword,|,search,replace,|,bullist,numlist,|,outdent,indent,blockquote,|,undo,redo,|,link,unlink,anchor,image,cleanup,help,code,|,insertdate,inserttime,preview,|,forecolor,backcolor",
            theme_advanced_buttons3: "tablecontrols,|,hr,removeformat,visualaid,|,sub,sup,|,charmap,emotions,iespell,media,advhr,|,print,|,ltr,rtl,|,fullscreen",
            theme_advanced_buttons4: "insertlayer,moveforward,movebackward,absolute,|,styleprops,spellchecker,|,cite,abbr,acronym,del,ins,attribs,|,visualchars,nonbreaking,template,blockquote,pagebreak,|,insertfile,insertimage",
            theme_advanced_toolbar_location: "top",
            theme_advanced_toolbar_align: "left",
            theme_advanced_statusbar_location: "bottom",
            paste_use_dialog: false,
            paste_auto_cleanup_on_paste: true,
            paste_convert_headers_to_strong: false,
            paste_strip_class_attributes: "all",
            paste_remove_spans: true,
            paste_remove_styles: true
        });
    </script>

</asp:Content>
